package com.dgut.service.serviceImpl;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.stp.StpUtil;
import com.dgut.common.SelectRole;
import com.dgut.mapper.AnnualReportMapper;
import com.dgut.mapper.OrderFlagMapper;
import com.dgut.pojo.AnnualReport;
import com.dgut.pojo.OrderFlag;
import com.dgut.service.AnnualReportService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class AnnualReportServiceImpl implements AnnualReportService {
    @Resource
    private AnnualReportMapper annualReportMapper;
    @Resource
    private OrderFlagMapper orderFlagMapper;

    /**
     * start-zwb
     */
    //通过id获取工商年报
    public Object getAnnualReport(Integer id)
    {
        return annualReportMapper.selectById(id);
    }
    /**
     * end-zwb
     */


    /**
     * start-gxd
     */
    /**
     * end-gxd
     */


    /**
     * start-lzh
     */
    @Override
    @SaCheckLogin
    @SaCheckRole(SelectRole.BUYER)
    public Object InsertAnnualReport(AnnualReport annualReport){
        ConcurrentHashMap resultMap = new ConcurrentHashMap();
        int insert = annualReportMapper.insert(annualReport);
        Object obj= StpUtil.getLoginId();
        Integer id = Integer.parseInt(obj.toString());
        OrderFlag orderFlag = new OrderFlag(id,null,"工商年报",6,new Date(),new Date(),new Date(),500.00,
                "待指派","已付款","正常");
        int insert1 = orderFlagMapper.insert(orderFlag);
        if(insert!=0 && insert1 !=0){
            resultMap.put("message","添加工商年报成功！");
        }else{
            resultMap.put("message","添加工商年报失败!");
        }
        return  resultMap;
    }
    /**
     * end-lzh
     */

    /**
     * start-hwf
     */
    /**
     * end-hwf
     */
}
